package com.观察者模式;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2023/8/9 13:52
 * @description:
 * @version:
 */
public class Main {
    public static void main(String[] args) {
        Subject subject = new Subject();
        Observer observer = new StockPriceDisplay();
        Observer observer2 = new StockPriceDisplay2();
        subject.attach(observer);
        subject.attach(observer2);
        subject.setStockPrice(100.0); // 触发更新通知
    }
}
